#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QToolBar>
#include <QStatusBar>
#include <QComboBox>
#include <QLabel>
#include <QKeyEvent>
#include <QTimer>
#include <QtSerialPort/QSerialPort>

#include "myopenglwidget.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void keyPressEvent(QKeyEvent *event);

private slots:
    void onOpen();
    void onSerialPortReadyRead();
    void onTimerTimeout();

private:
    QToolBar* m_toolBar;
    QComboBox* m_cbxPortList;
    QComboBox* m_cbxBaudrateList;
    QComboBox* m_cbxDataBitsList;
    QComboBox* m_cbxParityList;
    QComboBox* m_cbxStopBitsList;
    QAction* m_openAction;

    QStatusBar* m_statusBar;
    QLabel* m_lblAttitude;

    MyOpenGLWidget* m_myOpenGLWidget;
    QSerialPort* m_serialPort;
    QTimer* m_timer;
};
#endif // MAINWINDOW_H
